import { Controller, Get, Render } from '@nestjs/common';
import { VerificationCodeService } from 'src/component/code/verification-code.service';

@Controller()
export class CodeController {
  constructor(
    private readonly verificationCodeService: VerificationCodeService,
  ) {}

  @Get('/nest-admin/code')
  @Render('code/index') //使用render渲染模板引擎，参数就是文件路径：default文件夹下的index.ejs
  async getCode() {
    const list = await this.verificationCodeService.findAll();
    console.log("🚀 ~ file: code.controller.ts:14 ~ CodeController ~ getCode ~ list", list)
    return {
      list: list,
    }; //只有返回参数在模板才能获取，如果不传递参数，必须返回一个空对象
  }
}
